import csv
with open("data1.csv",mode = "w",encoding = "utf-8") as f:
    csv_writer = csv.writer(f)
    csv_writer.writerow(["姓名","年龄","城市"])
    csv_writer.writerow(["张三","19","上海"])
    csv_writer.writerow(["李四","20","北京"])
    csv_writer.writerows([["王五","21","郑州"],["马六","22","上海"]])